export default {
  paths2Array (paths) {
    if (paths && paths instanceof Array) {
      let oneArr = []
      for (var i = 0; i < paths.length; i++) {
        let twoArr = []
        let path = paths[i]
        twoArr.push(path.lng)
        twoArr.push(path.lat)
        oneArr.push(twoArr)
      }
      return oneArr
    }
  },
  position2Array (position) {
    if (position) {
      return [position.lng, position.lat]
    }
  },
  str2Path (str) {
    if (str) {
      let lnglatArr = str.split('_')
      let paths = []
      for (let s of lnglatArr) {
        let path = s.split(',')
        paths.push(path)
      }
      return paths
    }
  }
}
